package com.example.text.cyclone



import android.os.Build
import com.example.text.ui.mall.model.MallGoods


/**
 *@author Wcj
 *@description
 *@date 2023/5/9 16:14
 */
class AnalyticsEventMgr {

    companion object {
        private var instance: AnalyticsEventMgr? = null
        fun getInstance(): AnalyticsEventMgr {
            return instance ?: synchronized(this) {
                instance = AnalyticsEventMgr()
                instance!!
            }
        }
    }


//    /**登录埋点*/
//    @TrackMethod(des = Analytics.LOGIN_ACTION_KEY, trackParams = ["data"])
//    fun loginSuccessEvent(userName: String, userId: String) {
//        var data: AnalyticsData? = null
//        data = AnalyticsData(
//            date = DateUtil.formatDate(System.currentTimeMillis()),
//            brand = Build.BRAND,
//            os = "Android",
//            1,
//        )
//    }
//
    /**退出查看商品*/
    @TrackMethod(des = Analytics.GOODS_BROWSE_ACTION_KEY, trackParams = ["goods", "data"])
    fun goodsBrowseExitEvent(goods: MallGoods, times: String) {
        var data: AnalyticsData? = null
        data = AnalyticsData(
            brand = goods.brandName,
            productType = goods.productType,
            price = goods.purchasePrice.toString(),
            goodsId = goods.id,
            modelCode = goods.modelCode,
            model = goods.model,
            brandId = goods.brandId,
            title = goods.title,
            times = times,
            date = DateUtil.formatDate(System.currentTimeMillis()),
        )
    }
//
//    /**查看广告*/
//    @TrackMethod(des = Analytics.AD_ACTION_KEY, trackParams = ["data"])
//    fun adEvent(data: AnalyticsData) {
//
//    }
//
//    fun bannerAnalytics(banner: MallBanner?, show: Boolean, click: Boolean, adAddr: String? = null) {
//        banner ?: return
//        //广告埋点
//        val data = AnalyticsData(
//            date = System.currentTimeMillis().toString(),
//            adName = banner.name,
//            adId = banner.id.toString(),
//            adAddr = adAddr ?: banner.name,
//            show = show,
//            click = click,
//            type = banner.type
//        )
//        getInstance().adEvent(data)
//    }

}